package com.eorchis.module.classapplydep.ui.commond;

import com.eorchis.core.page.commond.SortInfoBean;
import com.eorchis.core.ui.commond.IQueryCommond;
import com.eorchis.core.ui.commond.impl.BasePageQueryCommond;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jackson.map.ObjectMapper;

/**
 * Title: ClassApplyDepCommond<br>
 * Description: 培训班-单位关系Commond<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author HuangTF
 * @createDate 2013-12-18
 * @version $Revision$
 */
public class ClassApplyDepQueryCommond extends BasePageQueryCommond implements IQueryCommond {

	private String[] searchClassApplydepIds;//培训班单位关系Ids
	private String searchClassApplydepId;//培训班单位关系Id
	private String classId;//班级ID
	private String[] depIds;//单位Ids
	private String depId;//单位ID
	private String depName;//单位名称
	private String parentId;//单位父级ID
	private Long searchRestrictPersonNum;//单位可报名人数

	public String[] getSearchClassApplydepIds() {
		return searchClassApplydepIds;
	}
	public void setSearchClassApplydepIds(String[] searchClassApplydepIds) {
		this.searchClassApplydepIds = searchClassApplydepIds;
	}
	public String getSearchClassApplydepId() {
		return searchClassApplydepId;
	}
	public void setSearchClassApplydepId(String searchClassApplydepId) {
		this.searchClassApplydepId = searchClassApplydepId;
	}
	public String getClassId() {
		return classId;
	}
	public void setClassId(String classId) {
		this.classId = classId;
	}
	public String[] getDepIds() {
		return depIds;
	}
	public void setDepIds(String[] depIds) {
		this.depIds = depIds;
	}
	public String getDepId() {
		return depId;
	}
	public void setDepId(String depId) {
		this.depId = depId;
	}
	public String getDepName() {
		return depName;
	}
	public void setDepName(String depName) {
		this.depName = depName;
	}
	public String getParentId() {
		return parentId;
	}
	public void setParentId(String parentId) {
		this.parentId = parentId;
	}
	public Long getSearchRestrictPersonNum() {
		return searchRestrictPersonNum;
	}
	public void setSearchRestrictPersonNum(Long searchRestrictPersonNum) {
		this.searchRestrictPersonNum = searchRestrictPersonNum;
	}
	
	
	/**
	 * EXT 页面排序
	 */
	private SortInfoBean sortInfo = null;
	
	/**
	 * 获取排序内容
	 * 
	 * @return
	 * @author HuangS
	 * @date Jul 20, 2012
	 */
	public SortInfoBean getSortInfos() {
		return this.sortInfo;
	}
	/**
	 * 设置排序内容
	 * 
	 * @param sort
	 * @author HuangS
	 * @date Jul 25, 2012
	 */
	@SuppressWarnings("unchecked")
	public void setSort(String sort) {
		if (sort != null && !"".equals(sort)) {
			sortInfo = new SortInfoBean();
			ObjectMapper objectMapper = new ObjectMapper();
			try {
				List<LinkedHashMap<String, Object>> list = objectMapper.readValue(sort, List.class);
				for (int i = 0; i < list.size(); i++) {
					Map<String, Object> map = list.get(i);
					Set<String> set = map.keySet();
					for (Iterator<String> it = set.iterator(); it.hasNext();) {
						String key = it.next();
						BeanUtils.setProperty(sortInfo, key, map.get(key));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
